package fl.ass.service.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import fl.ass.facade.dto.AssTrailCarFlowHistoryDTO;
import fl.ass.service.po.AssTrailCarFlowHistory;



 /**
 * @Description: 拖车审批流程：财务估算保底价（只读不可修改）
转优车流程：财务核算盈亏（只读不可修改）
拖车赎回流程：财务核算赎回金额、财务确认到账金额时间、财务做账
拖车管理处置流程：财务确认到账、财务做账
优车处置流程：财务确认来款、财务做账
 转换器
 * @Description: 服务层与展现层转换类
 * @Description: 所有的PO只能在持久成和服务层使用
 * @Description: 所有的DTO只能在展现层和服务层使用
 * @Description: 在服务层中向下是DTO转PO,向上是PO转DTO
 */
public class AssTrailCarFlowHistoryTransform {

	/**
	 * PO 转  DTO
	 * @param po AssTrailCarLfowHistory
	 * @return AssTrailCarLfowHistoryDTO
	 */
	public static AssTrailCarFlowHistoryDTO toDTO(AssTrailCarFlowHistory po) {
		AssTrailCarFlowHistoryDTO  dto = null;
		if (po != null) { 
			dto = new AssTrailCarFlowHistoryDTO();
			dto.setId(po.getId());
			dto.setContNo(po.getContNo());//CONT_NO
			dto.setCrTypCd(po.getCrTypCd());//CR_TYP_CD
			dto.setActLoanAmt(po.getActLoanAmt());//ACT_LOAN_AMT
			dto.setRetOfCapital(po.getRetOfCapital());//RET_OF_CAPITAL
			dto.setRetOfInteres(po.getRetOfInteres());//RET_OF_INTERES
			dto.setTotOfFine(po.getTotOfFine());//TOT_OF_FINE
			dto.setResidualPrincipal(po.getResidualPrincipal());//RESIDUAL_PRINCIPAL
			dto.setSurplusInterest(po.getSurplusInterest());//SURPLUS_INTEREST
			dto.setFineTot(po.getFineTot());//FINE_TOT
			dto.setOverdueRent(po.getOverdueRent());//OVERDUE_RENT
			dto.setReceivables(po.getReceivables());//RECEIVABLES
			dto.setTotal(po.getTotal());//TOTAL
			dto.setCstId(po.getCstId());//CST_ID
			dto.setBusinessid(po.getBusinessid());//BUSINESSID
			dto.setProcessinstanceid(po.getProcessinstanceid());//PROCESSINSTANCEID
			dto.setTaskdefkey(po.getTaskdefkey());//TASKDEFKEY

			dto.setCrtTm(po.getCrtTm());//创建时间
			dto.setCrtUsrId(po.getCrtUsrId());//创建人
			dto.setMdfTm(po.getMdfTm());//修改时间
			dto.setMdfUsrId(po.getMdfUsrId());//修改人
		}
		return dto;
	}

	/**
	 * DTO 转  PO
	 * @param dto AssTrailCarLfowHistoryDTO
	 * @return AssTrailCarLfowHistory
	 */
	public static AssTrailCarFlowHistory toPO(AssTrailCarFlowHistoryDTO dto) {
		AssTrailCarFlowHistory po = null;
		if (dto != null) {
			po = new AssTrailCarFlowHistory();
			po.setId(dto.getId());
			po.setContNo(dto.getContNo());//CONT_NO
			po.setCrTypCd(dto.getCrTypCd());//CR_TYP_CD
			po.setActLoanAmt(dto.getActLoanAmt());//ACT_LOAN_AMT
			po.setRetOfCapital(dto.getRetOfCapital());//RET_OF_CAPITAL
			po.setRetOfInteres(dto.getRetOfInteres());//RET_OF_INTERES
			po.setTotOfFine(dto.getTotOfFine());//TOT_OF_FINE
			po.setResidualPrincipal(dto.getResidualPrincipal());//RESIDUAL_PRINCIPAL
			po.setSurplusInterest(dto.getSurplusInterest());//SURPLUS_INTEREST
			po.setFineTot(dto.getFineTot());//FINE_TOT
			po.setOverdueRent(dto.getOverdueRent());//OVERDUE_RENT
			po.setReceivables(dto.getReceivables());//RECEIVABLES
			po.setTotal(dto.getTotal());//TOTAL
			po.setCstId(dto.getCstId());//CST_ID
			po.setBusinessid(dto.getBusinessid());//BUSINESSID
			po.setProcessinstanceid(dto.getProcessinstanceid());//PROCESSINSTANCEID
			po.setTaskdefkey(dto.getTaskdefkey());//TASKDEFKEY

			po.setCrtTm(dto.getCrtTm());//创建时间
			po.setCrtUsrId(dto.getCrtUsrId());//创建人
			po.setMdfTm(dto.getMdfTm());//修改时间
			po.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return po;
	}



	
	/**
	 * PO集合 转 DTO集合
	 * @param list List<AssTrailCarLfowHistory>
	 * @return List<AssTrailCarLfowHistoryDTO>
	 */
	public static List<AssTrailCarFlowHistoryDTO> toDTOList(List<AssTrailCarFlowHistory> list) {
		List<AssTrailCarFlowHistoryDTO>  voList = new ArrayList<AssTrailCarFlowHistoryDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AssTrailCarFlowHistory po : list) {
				voList.add(toDTO(po));
			}
		}
		return voList;
	}
}
